// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sysin

import (
	"context"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"

	"github.com/gogf/gf/v2/encoding/gjson"
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/os/gtime"
)

// AuctionProductMapperUpdateFields 修改拍品管理字段过滤
type AuctionProductMapperUpdateFields struct {
	AuctionId   int64       `json:"auctionId"   dc:"抢购"`
	ProductId   int64       `json:"productId"   dc:"商品"`
	BasePrice   float64     `json:"basePrice"   dc:"起拍价格"`
	MinBidPrice float64     `json:"minBidPrice" dc:"最低出价"`
	Status      int         `json:"status"      dc:"状态"`
	StartTime   *gtime.Time `json:"startTime"   dc:"当天开始时间"`
	EndTime     *gtime.Time `json:"endTime"     dc:"当天结束时间"`
	Weekday     *gjson.Json `json:"weekday"     dc:"每周运行时间"`
	Count       int         `json:"count"       dc:"数量"`
}

// AuctionProductMapperInsertFields 新增拍品管理字段过滤
type AuctionProductMapperInsertFields struct {
	AuctionId   int64       `json:"auctionId"   dc:"抢购"`
	ProductId   int64       `json:"productId"   dc:"商品"`
	BasePrice   float64     `json:"basePrice"   dc:"起拍价格"`
	MinBidPrice float64     `json:"minBidPrice" dc:"最低出价"`
	Status      int         `json:"status"      dc:"状态"`
	StartTime   *gtime.Time `json:"startTime"   dc:"当天开始时间"`
	EndTime     *gtime.Time `json:"endTime"     dc:"当天结束时间"`
	Weekday     *gjson.Json `json:"weekday"     dc:"每周运行时间"`
	Count       int         `json:"count"       dc:"数量"`
}

// AuctionProductMapperEditInp 修改/新增拍品管理
type AuctionProductMapperEditInp struct {
	entity.AuctionProductMapper
}

func (in *AuctionProductMapperEditInp) Filter(ctx context.Context) (err error) {
	// 验证抢购
	if err := g.Validator().Rules("required").Data(in.AuctionId).Messages("抢购不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证商品
	if err := g.Validator().Rules("required").Data(in.ProductId).Messages("商品不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证当天开始时间
	if err := g.Validator().Rules("required").Data(in.StartTime).Messages("当天开始时间不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	// 验证当天结束时间
	if err := g.Validator().Rules("required").Data(in.EndTime).Messages("当天结束时间不能为空").Run(ctx); err != nil {
		return err.Current()
	}

	return
}

type AuctionProductMapperEditModel struct{}

// AuctionProductMapperDeleteInp 删除拍品管理
type AuctionProductMapperDeleteInp struct {
	Id interface{} `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *AuctionProductMapperDeleteInp) Filter(ctx context.Context) (err error) {
	return
}

type AuctionProductMapperDeleteModel struct{}

// AuctionProductMapperViewInp 获取指定拍品管理信息
type AuctionProductMapperViewInp struct {
	Id int64 `json:"id" v:"required#id不能为空" dc:"id"`
}

func (in *AuctionProductMapperViewInp) Filter(ctx context.Context) (err error) {
	return
}

type AuctionProductMapperViewModel struct {
	Id               uint64      `json:"id"           dc:"id"`
	AuctionId        int64       `json:"auctionId"    dc:"抢购id"`
	ProductId        int64       `json:"productId"    dc:"商品id"`
	BasePrice        float64     `json:"basePrice"    dc:"起拍价格"`
	MinBidPrice      float64     `json:"minBidPrice"  dc:"最低出价"`
	StartTime        *gtime.Time `json:"startTime"    dc:"当天开始时间"`
	EndTime          *gtime.Time `json:"endTime"      dc:"当天结束时间"`
	Weekday          *gjson.Json `json:"weekday"      dc:"每周运行时间"`
	Count            int         `json:"count"        dc:"数量"`
	Status           int         `json:"status"      dc:"状态"`
	AuctionStartDate *gtime.Time `json:"auctionStartDate" dc:"开始日期"`
	AuctionEndDate   *gtime.Time `json:"auctionEndDate"   dc:"结束日期"`
}

// AuctionProductMapperListInp 获取拍品管理列表
type AuctionProductMapperListInp struct {
	form.PageReq
	Weekday   []int  `json:"weekday"     dc:"每周运行时间"`
	AuctionId uint64 `json:"auctionId" dc:"活动名称"`
	ProductId uint64 `json:"productId" dc:"商品"`
}

func (in *AuctionProductMapperListInp) Filter(ctx context.Context) (err error) {
	return
}

type AuctionProductMapperListModel struct {
	Id               int64       `json:"id"          dc:"id"`
	AuctionId        int64       `json:"auctionId"   dc:"抢购"`
	ProductId        int64       `json:"productId"   dc:"商品"`
	BasePrice        float64     `json:"basePrice"   dc:"起拍价格"`
	MinBidPrice      float64     `json:"minBidPrice" dc:"最低出价"`
	StartTime        *gtime.Time `json:"startTime"   dc:"当天开始时间"`
	EndTime          *gtime.Time `json:"endTime"     dc:"当天结束时间"`
	Weekday          *gjson.Json `json:"weekday"     dc:"每周运行时间"`
	Count            int         `json:"count"       dc:"数量"`
	Status           int         `json:"status"      dc:"状态"`
	AuctionStartDate *gtime.Time `json:"auctionStartDate" dc:"开始日期"`
	AuctionEndDate   *gtime.Time `json:"auctionEndDate"   dc:"结束日期"`
}

// AuctionProductMapperExportModel 导出拍品管理
type AuctionProductMapperExportModel struct {
	Id          int64       `json:"id"          dc:"id"`
	AuctionId   int64       `json:"auctionId"   dc:"抢购"`
	ProductId   int64       `json:"productId"   dc:"商品"`
	BasePrice   float64     `json:"basePrice"   dc:"起拍价格"`
	MinBidPrice float64     `json:"minBidPrice" dc:"最低出价"`
	StartTime   *gtime.Time `json:"startTime"   dc:"当天开始时间"`
	EndTime     *gtime.Time `json:"endTime"     dc:"当天结束时间"`
	Count       int         `json:"count"       dc:"数量"`
	AuctionName string      `json:"auctionName" dc:"活动名称"`
	ProductName string      `json:"productName" dc:"商品名称"`
}

type AuctionProductMapperActiveInp struct {
	ListType int `json:"listType" dc:"列表类型"`
}

type AuctionProductMapperActiveModel struct {
	Id             int64                  `json:"id"          dc:"id"`
	AuctionId      int64                  `json:"auctionId"   dc:"抢购"`
	ProductId      int64                  `json:"productId"   dc:"商品"`
	BasePrice      float64                `json:"basePrice"   dc:"起拍价格"`
	MinBidPrice    float64                `json:"minBidPrice" dc:"最低出价"`
	StartTime      *gtime.Time            `json:"startTime"   dc:"当天开始时间"`
	EndTime        *gtime.Time            `json:"endTime"     dc:"当天结束时间"`
	Weekday        *gjson.Json            `json:"weekday"     dc:"每周运行时间"`
	Count          int                    `json:"count"       dc:"数量"`
	Status         int                    `json:"status"      dc:"状态"`
	AuctionLogList []*AuctionLogListModel `json:"auctionLogList" dc:"竞拍记录"`
}
